<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="subdepartamento" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{subdepartamentoHome.managed ? 'Editar' : 'Agregar'} Bodega</f:facet>

<s:decorate id="IdDepartamento" template="layout/edit.xhtml">
     <ui:define name="label">Departamento</ui:define>
		<h:selectOneMenu value="#{subdepartamentoHome.instance.departamento}"
converter="#{departamentoListar.converter}"
requiredMessage="Seleccionar el departamento !!!"
required="true" 
    defaultLabel="Seleccione..." 
                directInputSuggestions="true"
                enableManualInput="false" 
                   disabled="#{subdepartamentoHome.managed}"
>
                
<f:selectItems value="#{departamentoListar.allDepartamento}"  />
</h:selectOneMenu>
		  </s:decorate>
            

<s:decorate id="IdUsuario" template="layout/edit.xhtml">
     <ui:define name="label">Usuario</ui:define>
		<h:selectOneMenu value="#{subdepartamentoHome.instance.usuario}"
converter="#{usuarioListar.converter}"
requiredMessage="Seleccionar el departamento !!!"
required="true" 
    defaultLabel="Seleccione..." 
                directInputSuggestions="true"
                enableManualInput="false" 
                   disabled="#{subdepartamentoHome.managed}"
style=" height : 22px;">
                
<f:selectItems value="#{usuarioListar.allUsuario}"  />
</h:selectOneMenu>
		  </s:decorate>
            


            <s:decorate id="descripcionField" template="layout/edit.xhtml">
                <ui:define name="label">Bodega</ui:define>
                <h:inputText id="descripcion"
                           size="50"
                      maxlength="50"
                      required="true"
                      requiredMessage="Ingreser el subpartamento !!!"
                          value="#{subdepartamentoHome.instance.descripcion}">
                    <a:support event="onblur" reRender="descripcionField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="encargadoField" template="layout/edit.xhtml">
                <ui:define name="label">Encargado</ui:define>
                <h:inputText id="encargado"
                           size="50"
                      maxlength="50"
                      required="true"
                      requiredMessage="Ingrese el encargado !!!"
                          value="#{subdepartamentoHome.instance.encargado}">
                    <a:support event="onblur" reRender="encargadoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>







            <s:decorate id="telefonoField" template="layout/edit.xhtml">
                <ui:define name="label">Telefono</ui:define>
                <h:inputText id="telefono"
                           size="7"
                      maxlength="7"
                          value="#{subdepartamentoHome.instance.telefono}">
                    <a:support event="onblur" reRender="telefonoField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                campos requeridos !!!
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Guardar"
                         action="#{subdepartamentoHome.persist}"
                       disabled="#{!subdepartamentoHome.wired}"
                       rendered="#{!subdepartamentoHome.managed}"/>

            <h:commandButton id="update"
                          value="Actualizar"
                         action="#{subdepartamentoHome.update}"
                       rendered="#{subdepartamentoHome.managed}"/>

            <h:commandButton id="delete"
                          value="Eliminar"
                         action="#{subdepartamentoHome.remove}"
                      immediate="true"
                       rendered="#{subdepartamentoHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancelar"
             propagation="end"
                    view="/Subdepartamento.xhtml"
                rendered="#{subdepartamentoHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancelar"
             propagation="end"
                    view="/#{empty subdepartamentoFrom ? 'SubdepartamentoList' : subdepartamentoFrom}.xhtml"
                rendered="#{!subdepartamentoHome.managed}"/>

        </div>
    </h:form>
</ui:define>

</ui:composition>
